package com.szbmyoubao.app.view.dialog

import android.app.Activity
import android.app.Dialog
import android.view.KeyEvent

/**
 * @author ellecity06
 * @time 2024/12/2 10:11
 * @des
 */
class BackDialog(val activity: Activity, theme: Int) : Dialog(activity, theme) {
    init {
        setCanceledOnTouchOutside(false)
    }

    override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {

        if ( keyCode == KeyEvent.KEYCODE_BACK) {
            activity.onBackPressed()
            return true
        }

        return super.onKeyDown(keyCode, event)

    }
}